#pragma once

#include <list>

class Character;
class Item;
class Obstacle;
class Corpse;

class GameState {
protected:
	std::list<Character*> m_characters;
	std::list<Character*> m_deadCharacters;
	std::list<Item*> m_destroyedItems;
	std::list<Obstacle*> m_destroyedObstacles;
	std::list<Corpse*> m_corpses;
	bool m_playersTurn;
	bool m_playerTookTurn;
	void insertionSort(Character *c);
	void resolveTurns();
	void takeTurns();
	void cleanUp();
	void playerTookTurn();
public:
	GameState();
	~GameState();
	void updateCharacterList();
	void markPlayerTookTurn();
	void checkPlayerTookTurn();
	bool isPlayersTurn() const;
	void removeCharacter(Character* c);
	void addCharacter(Character* c);
	void removeCorpse(Corpse* c);
	void addCorpse(Corpse* c);
	void markForDeletion(Character* c);
	void markForDeletion(Item* i);
	void markForDeletion(Obstacle* o);
};

inline bool GameState::isPlayersTurn() const {return m_playersTurn;}
